#ifndef BREAKPOINTS_HPP
#define BREAKPOINTS_HPP

#include <QDockWidget>
#include <QMap>
#include <QTableWidgetItem>
#include <QMapIterator>

#include "programmanagement.hpp"
#include "command.hpp"

namespace Ui {
    class Breakpoints;
}

/**
* @brief
*
* @class Breakpoints breakpoints.hpp "breakpoints.hpp"
*/
class Breakpoints : public QDockWidget {
    Q_OBJECT
public:
    /**
    * @brief
    *
    * @fn Breakpoints
    * @param parent
    */
    Breakpoints(QWidget *parent = 0);

    /**
    * @brief
    *
    * @fn ~Breakpoints
    */
    ~Breakpoints();

    void reset();

protected:
    /**
    * @brief
    *
    * @fn changeEvent
    * @param e
    */
    void changeEvent(QEvent *e);

private:
    struct Breakpoint {
	QString anchor;
	QTableWidgetItem *line;
	QTableWidgetItem *code;
    };

    Ui::Breakpoints *ui;
    QMap<int, Breakpoint> breakpointMap;

public slots:
    void onBreakpointToggled(int line, bool add, QString asmCode, QString anchor);

private slots:
    void on_tbl_breakpoints_cellDoubleClicked(int row, int column);

signals:
    void jumpToBreakpoint(QString anchor);
};

#endif // BREAKPOINTS_HPP
